*** REPLICATION TOOLKIT ***

* AUTHORS: CIMINELLI DUVAL FURCERI 

* ARTICLE: EMPLOYMENT PROTECTION DEREGULATION AND LABOR SHARES IN ADVANCED ECONOMIES 

* JOURNAL: REVIEW OF ECONOMICS AND STATISTICS

* THIS FILE PREPARE THE VARIABLES TO BE USED FOR THE ANALYSIS

***************************

cd ""

global horizon 6 

use "DTA files/Dataset", clear

************* CLEAN DATASET ******************

* Drop Norway (labor share N/A)
drop if country=="Norway"

* Drop aggregate industries
drop if industry=="C" | industry=="G" | industry=="H" | industry=="J" | industry=="OtU" | industry=="MARKT" | industry=="TOT" | industry=="RtS" 

* Drop industries T and U (labor share N/A)
drop if industry=="T" | industry=="U"

* Drop industries excluded in analysis
keep if industry!="P" & industry!="Q" & industry!="O" & industry!="19" & industry!="A" & industry!="F" & industry!="31t33"

* Set panel
xtset id_cross_section year

************ PREPARE VARIABLES **********

* Labor share
gen Y = 100*lab / va

* Dependent variables
foreach v in Y {
gen `v'1 = `v'-l.`v'
forvalues i = 2 / $horizon {
local sc = `i'-1
gen `v'`i' = f`sc'.`v'-l.`v'
}
}

* Lags dependent variable
foreach v in Y {
forvalues l = 1 / 6 {
gen l`l'`v' = l`l'.`v'1
}
}

* Epsilon
gen epsilon1 = (EOS_serv4_OLS-1)/EOS_serv4_OLS

* Main explanatory variable (EPL reform regular contract interacted with industry-specific characteristics) 
* normalized so to show differential responses between 25th and 75th percentiles
gen s2 = layoff_rate
gen s3 = -epsilon1
gen s4 = -epsilon1*layoff_rate
forvalues i = 2 / 4 {
quietly sum s`i', detail
local sc1 = r(p75)
local sc2 = r(p25)
gen r`i' = (EPLregularworkers*s`i')/(`sc1'-`sc2')  
}

* Lags and forwards of explanatory variables
forvalues s = 2/4 {
forvalues l = 1 / 6 {
gen l`l'r`s' = l`l'.r`s'
}
forvalues f = 1 / 5 {
gen f`f'r`s' = f`f'.r`s'
}
}

* Global for forward variables (Teulings and Zubanov)
forvalues s = 2/4 {
global f1`s'
global f2`s' f1r`s'
global f3`s' f1r`s' f2r`s'
global f4`s' f1r`s' f2r`s' f3r`s'
global f5`s' f1r`s' f2r`s' f3r`s' f4r`s'
global f6`s' f1r`s' f2r`s' f3r`s' f4r`s' f5r`s'
}

* EPL reform temporary contract, interacted with industry-specific characteristics
gen t2 = EPLtemporaryworkers*layoff_rate
gen t3 = -EPLtemporaryworkers*epsilon1
gen t4 = -EPLtemporaryworkers*epsilon1*layoff_rate
